#pragma once
#include "StdAfx.h"
#include "KillAction.h"
#include "Controller.h"
#include "EntityControl.h"
#include "StackAllocator.h"
#include "StackAllocatorManager.h"
#include "IStackAllocator.h"

//class EntityControl;

KillAction::KillAction(EntityControl *entity)
{
	deleted = false;
	targetEntity = entity;


}


KillAction::~KillAction(void)
{
	deleted = true;
}

void* KillAction::operator new (size_t size)
{
	return  StackAllocatorManager::getSingleton().allocateObject<KillAction>("KillAction",10);
}


void KillAction::operator delete (void *currentAction)
{
	StackAllocatorManager::getSingleton().freeObject<KillAction>("KillAction",((KillAction*)currentAction));
}



bool KillAction::FireTrigger(EntityControl *entity)
{
	//std::vector<Controller*> *controllers = targetEntity->getControllers();
	
	/*for(int i=0; i<controllers->size(); i++)
	{
		controllers->at(i)->kill();
	}*/

	targetEntity->kill();


	
	return true;
}